| 1 |  |  | // const request = require('supertest'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | // const express = require('express'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | // const app = require('../index'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | // const app = require('../api/read'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | // const { describe, expect, test } = require('mocha'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 9 |  |  | // describe('Test the error path', () => { | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | //     test('It should response the GET method', (done) => { | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | //         request(app).get('/error').then((response) => { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | //             expect(response.statusCode).toBe(404); | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | //             done(); | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  | //         }); | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | //     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | // }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | // | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | // describe('Test the api/read path', () => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | //     test('It should response the GET method', (done) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | //         request(app).get('/api/read').then((response) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | //             expect(response.statusCode).toBe(200); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | //             done(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | //         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | //     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | // }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | // | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | // describe('Test the api/add path', () => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | //     test('It should response the POST method', (done) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | //         request(app).post('/api/add').then((response) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | //             expect(response.statusCode).toBe(200); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | //             done(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | //         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | //     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | // }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | // | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | // describe('Test the api/update path', () => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | //     test('It should response the PUT method', (done) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | //         request(app).put('/api/update').then((response) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | //             expect(response.statusCode).toBe(200); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | //             done(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | //         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | //     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | // }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | // | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | // describe('Test the api/remove path', () => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | //     test('It should response the DELETE method', (done) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | //         request(app).delete('/api/remove').then((response) => { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | //             expect(response.statusCode).toBe(200); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | //             done(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | //         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | //     }); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 53 |  |  | // }); | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |  |